<?php

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;

class  AfterMiddleware
{
    public function __invoke(Request $request, RequestHandler $handler): Response
    {
        var_dump('AfterMiddleware');
        // Invoke the next middleware and get response
        $response = $handler->handle($request);

        // Handle the outgoing response
        // ...
        return $response;
    }
}